package scientistengineer.blogspot.affrpor;


import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;


public class AffrPorMainActivity extends Activity {
	
	private RowIconText [] row_data;
	private IconTextAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_affr_por_main);
			
		row_data = new RowIconText[]
				{
				new RowIconText(R.drawable.one_star, "Beginner"),
				new RowIconText(R.drawable.grammar, "Grammar"),
				new RowIconText(R.drawable.intermediate, "Intermediate"),	
				new RowIconText(R.drawable.advanced, "Advanced"),
				new RowIconText(R.drawable.super_advanced, "Super Advanced"),
				new RowIconText(R.drawable.intelectual, "Intelectual"),
				new RowIconText(R.drawable.slang, "Slang")
				
				};
		adapter = new IconTextAdapter(this, R.layout.listview_icon_text , row_data);
		
		ListView codeLearnLessons = (ListView)findViewById(R.id.mainMenuListView);
		
		codeLearnLessons.setAdapter(adapter);
		codeLearnLessons.setOnItemClickListener(new OnItemClickListener()
		{

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				switch(position)
				{
				case 0:
					//beginner
					Intent launchBeginner = new Intent(AffrPorMainActivity.this, Beginner.class);
					startActivity(launchBeginner);	
					break;
				case 1:
					//grammar
					Intent launchGrammar = new Intent(AffrPorMainActivity.this, Grammar.class);
					startActivity(launchGrammar);				
					break;
				case 2:
					//intermediate
					Intent launchIntermediate = new Intent(AffrPorMainActivity.this, Intermediate.class);
					startActivity(launchIntermediate);
					break;
				}			
			}		
		});
	}


}
